import 'dart:ui';

import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';

import '../../helper/utils/util.dart';
import 'index.dart';
import 'widgets/widgets.dart';

class MePage extends StatelessWidget {
  MePage({Key? key}) : super(key: key);
  final controller = Get.put(MeController());
  final state = Get.find<MeController>().state;
  // 主视图
  Widget _buildView() {
    return Stack(
      children: [
        const MeBgWidget(),
        BackdropFilter(
          filter: ImageFilter.blur(sigmaX: 10, sigmaY: 10),
          child: SizedBox(
            height: 1.sh,
          ),
        ),
        Container(
          width: 1.sw,
          height: 1.sh,
          child: ListView(
            children: [
              Padding(
                padding: EdgeInsets.symmetric(horizontal: 30.r),
                child: Column(
                  children: [
                    SafeArea(
                      child: SizedBox(
                        height: 50.r,
                      ),
                    ),
                    const PersonCard(),
                    SizedBox(
                      height: 30.r,
                    ),
                  ],
                ),
              ),

              Column(
                children: state.list
                    .map((e) => MeCell(
                        onTap: e.onTap,
                        icon: e.icon,
                        color: e.color,
                        bgColor: e.bgColor,
                        title: e.name))
                    .toList(),
              ),
              // Wrap(
              //   spacing: 15.r,
              //   runSpacing: 15.r,
              //   children: state.list
              //       .map(
              //         (e) => MenuItemView(
              //           onTap: e.onTap,
              //           color: e.bgColor,
              //           width: (Get.width - 90.r) / 3,
              //           height: (Get.width - 90.r) / 3,
              //           spacing: 10.r,
              //           icon: Icon(
              //             e.icon,
              //             size: 25.r,
              //             color: e.color,
              //           ),
              //           title: Text(
              //             e.name,
              //             style: TextStyle(
              //                 color: Color(0xff333333), fontSize: 13.sp),
              //           ),
              //         ),
              //       )
              //       .toList(),
              // )
            ],
          ),
        )
      ],
    );
  }

  @override
  Widget build(BuildContext context) {
    return GetBuilder<MeController>(
      builder: (_) {
        return Scaffold(
          body: _buildView(),
        );
      },
    );
  }
}
